<template>
  <div class="page-header-index-wide">
    <a-card :bordered="false" :body-style="{ padding: '16px 0', height: '100%' }" :style="{ height: '100%' }">
      <div class="account-settings-info-main" :class="{ 'mobile': isMobile }">
        <div class="account-settings-info-left">
          <a-menu
            :mode="isMobile ? 'horizontal' : 'inline'"
            :style="{ border: '0', width: isMobile ? '560px' : 'auto'}"
            :selected-keys="selectedKeys"
            type="inner"
            @openChange="onOpenChange"
          >
            <a-menu-item key="/shop/ShopPage">
              <router-link :to="{ name: 'ShopPage' }">
                店铺页面
              </router-link>
            </a-menu-item>
            <a-menu-item key="/shop/navigation">
              <router-link :to="{ name: 'ShopNavigation' }">
                店铺导航
              </router-link>
            </a-menu-item>
            <a-menu-item key="/shop/ShopUser">
              <router-link :to="{ name: 'ShopUser' }">
                用户中心
              </router-link>
            </a-menu-item>
            <a-menu-item key="/shop/ShopList">
              <router-link :to="{ name: 'ShopList' }">
                列表模板
              </router-link>
            </a-menu-item>
            <a-menu-item key="/shop/ShopClass">
              <router-link :to="{ name: 'ShopClass' }">
                分类模板
              </router-link>
            </a-menu-item>
            <a-menu-item key="/shop/ShopSearch">
              <router-link :to="{ name: 'ShopSearch' }">
                搜索页
              </router-link>
            </a-menu-item>
            <a-menu-item key="/shop/ShopColorSystem">
              <router-link :to="{ name: 'ShopColorSystem' }">
                店铺色系
              </router-link>
            </a-menu-item>
          </a-menu>
        </div>
        <div class="account-settings-info-right">
          <div class="account-settings-info-title">
            <span>{{ $route.meta.title }}</span>
          </div>
          <route-view />
        </div>
      </div>
    </a-card>
  </div>
</template>

<script>
import { RouteView } from '@/layouts'
import { baseMixin } from '@/store/app-mixin'

export default {
  components: {
    RouteView
  },
  mixins: [baseMixin],
  data() {
    return {
      // horizontal  inline
      mode: 'inline',

      openKeys: [],
      selectedKeys: [],

      // cropper
      preview: {},
      option: {
        img: '/avatar2.jpg',
        info: true,
        size: 1,
        outputType: 'jpeg',
        canScale: false,
        autoCrop: true,
        // 只有自动截图开启 宽度高度才生效
        autoCropWidth: 180,
        autoCropHeight: 180,
        fixedBox: true,
        // 开启宽度和高度比例
        fixed: true,
        fixedNumber: [1, 1]
      },

      pageTitle: ''
    }
  },
  watch: {
    '$route'(val) {
      this.updateMenu()
    }
  },
  mounted() {
    this.updateMenu()
  },
  methods: {
    onOpenChange(openKeys) {
      this.openKeys = openKeys
    },
    updateMenu() {
      const routes = this.$route.matched.concat()
      this.selectedKeys = [routes.pop().path]
    }
  }
}
</script>

<style lang="less" scoped>

</style>
